﻿using SuperSocket.SocketBase.Command;
using SuperSocket.SocketBase.Protocol;
using System.IO;
using System.Text;
using TransferCommon;

namespace TransferServerLib.UpLoad.Command
{
    public class CheckExist : CommandBase<TransferSession, BinaryRequestInfo>
    {
        public override void ExecuteCommand(TransferSession session, BinaryRequestInfo requestInfo)
        {
            if (File.Exists(Path.GetFullPath(Encoding.UTF8.GetString(requestInfo.Body))))
            {
                session.UpLoadEngine.OnCheckFile(UpLoadOP.CheckExist, true);
            }
            else
            {
                session.UpLoadEngine.OnCheckFile(UpLoadOP.CheckExist, false);
            }
        }
    }
}
